<?php
if (!defined("__WD__")) exit("Wrong Connect");


class Solr extends __Controller {
	
	function __construct() {
		parent::__construct();

		$this->data->title		= "Wandu Administrator";
		$this->data->library	= "http://".HOME."/library";
		$this->data->href		= "http://".HOME."/admin";

	}	
	function index() {
		
		$this->load->module("input", $this->input);

		$this->load->view("solr/header");
		$this->load->view("solr/search");
		//java -jar -Durl=http://localhost:8080/solr/update post.jar solr.xml monitor.xml


		if ($this->input->post_exists()) {
			$result = file_get_contents("http://127.0.0.1:8080/solr/collection1/select?q=".$this->input->post("keyword")."&wt=json&indent=true");
			$result = json_decode($result, 1);
			$this->data->qtime	= $result['responseHeader']['QTime'];
			$this->data->q		= $result['responseHeader']['params']['q'];
			$this->data->num	= $result['response']['numFound'];
			$this->data->rows	= $result['response']['docs'];
			$this->load->view("solr/result");
		}

		$this->load->view("solr/footer");
		
	}
	
}